# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.CloudChannel.V1.Model.GoogleCloudChannelV1Customer do
  @moduledoc """
  Entity representing a customer of a reseller or distributor.

  ## Attributes

  *   `alternateEmail` (*type:* `String.t`, *default:* `nil`) - Secondary contact email. You need to provide an alternate email to create different domains if a primary contact email already exists. Users will receive a notification with credentials when you create an admin.google.com account. Secondary emails are also recovery email addresses. Alternate emails are optional when you create Team customers.
  *   `channelPartnerId` (*type:* `String.t`, *default:* `nil`) - Cloud Identity ID of the customer's channel partner. Populated only if a channel partner exists for this customer.
  *   `cloudIdentityId` (*type:* `String.t`, *default:* `nil`) - Output only. The customer's Cloud Identity ID if the customer has a Cloud Identity resource.
  *   `cloudIdentityInfo` (*type:* `GoogleApi.CloudChannel.V1.Model.GoogleCloudChannelV1CloudIdentityInfo.t`, *default:* `nil`) - Output only. Cloud Identity information for the customer. Populated only if a Cloud Identity account exists for this customer.
  *   `correlationId` (*type:* `String.t`, *default:* `nil`) - Optional. External CRM ID for the customer. Populated only if a CRM ID exists for this customer.
  *   `createTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. Time when the customer was created.
  *   `domain` (*type:* `String.t`, *default:* `nil`) - Required. The customer's primary domain. Must match the primary contact email's domain.
  *   `languageCode` (*type:* `String.t`, *default:* `nil`) - Optional. The BCP-47 language code, such as "en-US" or "sr-Latn". For more information, see https://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Output only. Resource name of the customer. Format: accounts/{account_id}/customers/{customer_id}
  *   `orgDisplayName` (*type:* `String.t`, *default:* `nil`) - Required. Name of the organization that the customer entity represents.
  *   `orgPostalAddress` (*type:* `GoogleApi.CloudChannel.V1.Model.GoogleTypePostalAddress.t`, *default:* `nil`) - Required. The organization address for the customer. To enforce US laws and embargoes, we require a region, postal code, and address lines. You must provide valid addresses for every customer. To set the customer's language, use the Customer-level language code.
  *   `primaryContactInfo` (*type:* `GoogleApi.CloudChannel.V1.Model.GoogleCloudChannelV1ContactInfo.t`, *default:* `nil`) - Primary contact info.
  *   `updateTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. Time when the customer was updated.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :alternateEmail => String.t() | nil,
          :channelPartnerId => String.t() | nil,
          :cloudIdentityId => String.t() | nil,
          :cloudIdentityInfo =>
            GoogleApi.CloudChannel.V1.Model.GoogleCloudChannelV1CloudIdentityInfo.t() | nil,
          :correlationId => String.t() | nil,
          :createTime => DateTime.t() | nil,
          :domain => String.t() | nil,
          :languageCode => String.t() | nil,
          :name => String.t() | nil,
          :orgDisplayName => String.t() | nil,
          :orgPostalAddress => GoogleApi.CloudChannel.V1.Model.GoogleTypePostalAddress.t() | nil,
          :primaryContactInfo =>
            GoogleApi.CloudChannel.V1.Model.GoogleCloudChannelV1ContactInfo.t() | nil,
          :updateTime => DateTime.t() | nil
        }

  field(:alternateEmail)
  field(:channelPartnerId)
  field(:cloudIdentityId)

  field(:cloudIdentityInfo,
    as: GoogleApi.CloudChannel.V1.Model.GoogleCloudChannelV1CloudIdentityInfo
  )

  field(:correlationId)
  field(:createTime, as: DateTime)
  field(:domain)
  field(:languageCode)
  field(:name)
  field(:orgDisplayName)
  field(:orgPostalAddress, as: GoogleApi.CloudChannel.V1.Model.GoogleTypePostalAddress)
  field(:primaryContactInfo, as: GoogleApi.CloudChannel.V1.Model.GoogleCloudChannelV1ContactInfo)
  field(:updateTime, as: DateTime)
end

defimpl Poison.Decoder, for: GoogleApi.CloudChannel.V1.Model.GoogleCloudChannelV1Customer do
  def decode(value, options) do
    GoogleApi.CloudChannel.V1.Model.GoogleCloudChannelV1Customer.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.CloudChannel.V1.Model.GoogleCloudChannelV1Customer do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
